<?php
class WlcatErrorException {
    private static $instance;
    private function __construct()
    {

    }
    private function __clone() {

    }

    public function setDeafult(){
        // Getting Last Error
        $last_error =  error_get_last();

        // Check if Last error is of type FATAL
        if(isset($last_error['type']) && $last_error['type']==E_ERROR)
        {
            exit($last_error['message']);
            // Fatal Error Occurs
            // Do whatever you want for FATAL Errors
        }
    }

    public static function getInstance()
    {
        if (!self::$instance)
        {
            self::$instance = new self();
        }
        return self::$instance;
    }
    public static function init()
    {
        return self::getInstance()->setDeafult();
    }
}